import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Al_Compny_backend.settings')
app = Celery('Al_Compny_backend')
app.conf.worker_pool = 'solo'
app.config_from_object('django.conf:settings', namespace='CELERY')
# 强制设置 Redis，防止默认 RabbitMQ
app.conf.update(
    broker_url='redis://localhost:6379/0',
    result_backend='redis://localhost:6379/0'
)
app.autodiscover_tasks()
